Skip to content

Conversation

@agents-git-bot
Copy link
Contributor

@agents-git-bot agents-git-bot bot commented Dec 10, 2025

Summary

This PR syncs documentation for cloudflare/agents PR #729: Add client-defined tools and prepareSendMessagesRequest options

Source PR: cloudflare/agents#729

Changes

New Guide: Client Tools Auto-Continuation (/agents/guides/client-tools-continuation/)

  • Created comprehensive guide explaining the autoContinueAfterToolResult feature
  • Documented how client tools can behave like server tools with automatic continuation
  • Explained the difference between automatic and manual continuation flows
  • Provided implementation examples and use cases
  • Added integration examples with human-in-the-loop workflows

Human-in-the-Loop Guide Updates (/agents/guides/human-in-the-loop/)

  • Added autoContinueAfterToolResult option to useAgentChat configuration
  • Added new section explaining automatic continuation after tool execution
  • Included step-by-step explanation of the auto-continuation flow
  • Added cross-reference to the new client tools continuation guide
  • Updated Related resources section with link to new guide

Agents API Documentation Updates (/agents/api-reference/agents-api/)

  • Added three new useAgentChat options with inline documentation:
    • tools: Record of client-side tools with optional execute functions
    • toolsRequiringConfirmation: Array of tool names requiring human approval
    • autoContinueAfterToolResult: Boolean for automatic conversation continuation after tool results

Key Features Documented

  1. Client-side tool execution: Tools can now execute in the browser with execute functions
  2. Auto-continuation: autoContinueAfterToolResult option enables seamless tool execution flow that mimics server-side tool behavior
  3. Human-in-the-loop workflows: toolsRequiringConfirmation option allows selective approval for sensitive operations
  4. Improved message handling: Tool results are properly processed and the LLM can respond in a single, unified message

Documentation Style Compliance

  • Follows Cloudflare docs style guidelines
  • Uses proper relative links with trailing slashes
  • Includes appropriate cross-references between related guides
  • Follows Diátaxis framework (concepts, how-to guides, reference)

🤖 Generated with Claude Code

@github-actions github-actions bot added the product:agents Build and deploy AI-powered Agents on Cloudflare that can act autonomously. label Dec 10, 2025
@github-actions
Copy link
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/agents/ @irvinebroque, @rita3ko, @elithrar, @thomasgauvin, @threepointone, @whoiskatrin, @cloudflare/pcx-technical-writing, @cloudflare/ai-agents

@agents-git-bot agents-git-bot bot force-pushed the sync-docs-pr-729 branch 3 times, most recently from 5c8103e to 44c7ff2 Compare December 10, 2025 15:41
@agents-git-bot
Copy link
Contributor Author

Updated documentation with comprehensive coverage of the new clientTools and prepareSendMessagesRequest options for the useAgentChat hook.

Changes include:

  • Added section on client-defined tools with simple and advanced examples
  • Updated TypeScript type definitions for UseAgentChatOptions
  • Documented ClientTool type and prepareSendMessagesRequest callback signatures
  • Provided practical examples for embeddable chat widgets
  • Explained how both options can be combined

The documentation follows the Diátaxis framework by providing:

  • Reference: Complete type definitions and API signatures
  • Examples: Practical code snippets showing real-world usage
  • Explanation: When and why to use each option

@agents-git-bot agents-git-bot bot force-pushed the sync-docs-pr-729 branch 2 times, most recently from fa64a63 to a3ffa7b Compare December 10, 2025 20:07
@agents-git-bot agents-git-bot bot changed the title docs: sync PR #729 - add client-defined tools and prepareSendMessagesRequest options add client-defined tools and prepareSendMessagesRequest options Dec 10, 2025
@agents-git-bot agents-git-bot bot force-pushed the sync-docs-pr-729 branch 2 times, most recently from ca27911 to 0dfefa9 Compare December 11, 2025 11:30
@agents-git-bot
Copy link
Contributor Author

Added additional documentation for client-defined tools in the Using AI Models page (using-ai-models.mdx).

This complements the API reference documentation by providing:

  • Practical examples of client-side tool definitions for embeddable chat widgets
  • Server-side integration patterns with createToolsFromClientSchemas
  • Advanced usage with prepareSendMessagesRequest for custom headers and context
  • Complete API reference for all new types and functions

The documentation now covers the feature from both a conceptual/usage perspective (in using-ai-models.mdx) and from an API reference perspective (in agents-api.mdx).

@agents-git-bot agents-git-bot bot changed the title add client-defined tools and prepareSendMessagesRequest options Sync docs for PR 729: add client-defined tools and prepareSendMessagesRequest options Dec 11, 2025
@agents-git-bot agents-git-bot bot force-pushed the sync-docs-pr-729 branch 2 times, most recently from e785e9c to 904dc39 Compare December 12, 2025 09:17
@agents-git-bot
Copy link
Contributor Author

Updated documentation for client-defined tools feature from cloudflare/agents#729.

Changes Made

Added comprehensive documentation for the new client-defined tools feature:

  1. Client-side tool definition - How to define tools with execute functions that run on the client
  2. Server-side tool handling - Using createToolsFromClientSchemas() to handle client tools on the server
  3. Custom request data - Using prepareSendMessagesRequest for custom headers and dynamic context

The documentation follows the Diátaxis framework with:

  • Reference documentation for the API types
  • Practical examples showing real-world usage
  • Step-by-step code samples for both client and server

All examples use Cloudflare Docs style components (TypeScriptExample) and follow the style guide requirements.

@agents-git-bot agents-git-bot bot changed the title Sync docs for PR 729: add client-defined tools and prepareSendMessagesRequest options add client-defined tools and prepareSendMessagesRequest options Dec 12, 2025
@agents-git-bot agents-git-bot bot changed the title add client-defined tools and prepareSendMessagesRequest options Add documentation for client-defined tools and dynamic tool registration Dec 12, 2025
@agents-git-bot agents-git-bot bot changed the title Add documentation for client-defined tools and dynamic tool registration Sync docs for PR 729: add client-defined tools and prepareSendMessagesRequest options Dec 12, 2025
@agents-git-bot
Copy link
Contributor Author

Updated documentation with comprehensive changes including:

  • Corrected client-side tool definitions to use JSON Schema (parameters field) instead of Zod (inputSchema)
  • Added detailed explanation of autoContinueAfterToolResult feature
  • Updated server-side processing to properly handle tool confirmations
  • Added working examples for client-side tools with human approval workflows
  • Cross-linked between guides and API reference for better discoverability

All changes are based on the actual implementation in PR #729 of the agents repository.

Document new features from cloudflare/agents PR #729:
- Add client-side tools support via useAgentChat
- Add toolsRequiringConfirmation option for human-in-the-loop
- Add autoContinueAfterToolResult for seamless tool execution
- Update human-in-the-loop guide with new patterns
- Update API reference with detailed tool configuration examples

Synced from: cloudflare/agents#729

Generated with Claude Code https://claude.com/claude-code

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@agents-git-bot
Copy link
Contributor Author

Updated documentation to reflect changes from cloudflare/agents PR #729:

Changes Made:

API Reference (agents-api.mdx)

  • Added tools, toolsRequiringConfirmation, and autoContinueAfterToolResult options to useAgentChat type definition
  • Added comprehensive documentation for client-defined tools with code examples
  • Documented tool confirmation workflows for human-in-the-loop patterns
  • Explained auto-continuation behavior and its benefits

Human-in-the-Loop Guide (human-in-the-loop.mdx)

  • Updated client tools definition to use JSON Schema format with execute functions
  • Added autoContinueAfterToolResult: true to the useAgentChat example
  • Updated server-side tool processing to match new implementation pattern
  • Improved documentation of message streaming with confirmations

Key Features Documented:

  1. Client-defined tools: Execute logic on the client side with access to browser APIs
  2. Human-in-the-loop: Require user confirmation before tool execution
  3. Auto-continuation: Seamless responses after tool execution without extra user input

These changes ensure developers understand how to implement sophisticated tool execution patterns with proper user oversight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:agents Build and deploy AI-powered Agents on Cloudflare that can act autonomously. size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants